<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>LifeCycle</title>
    </head>
    <body>
        <div id="app">
           <div v-color="color">color</div>
        </div>
        <script src="my-vue.js"></script>
        <script>  
        Vue.directive('color',{
            bind(el,binding){
                el.style.color = binding.value;
            },
            update(el,binding){
                console.log(binding.oldValue,binding.value)
                el.style.color = binding.value;
            }
        });
        var vm = new Vue({
            el:'#app',
            data:{
                color:'green'
            },
        });
    </script>
    </body>
</html>